package com.cg.controller;

import com.alipay.api.AlipayApiException;
import com.cg.dto.Dto;
import com.cg.dto.DtoUtil;
import com.cg.utils.AliPayUtil;
import com.cg.utils.MQUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    private MQUtil mqUtil;


    @GetMapping("/sendMessage")
    public Dto sendMessage(String msg){
        mqUtil.sendMessage(msg);
        return DtoUtil.returnSuccess();
    }


    @Resource
    private AliPayUtil aliPayUtil;

    @GetMapping("/toPay")
    public String toPay(String orderNo,String totalAmount) throws AlipayApiException {
        return aliPayUtil.toPay(orderNo,totalAmount);
    }
}
